<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href='<?php echo  base_url(); ?>css/main.css' type="text/css"/>
<script>
function selectAll(id)
{
    var obj = document.getElementsByTagName('input');
    for (i = 0; i < obj.length; i++ )
    {    if(obj[i].className=="ids"){
            obj[i].checked = id.checked;
	  }
    }
}
</script>
</head>

<body>
<div class="content" style="width:1100px;">
    <div class="add" >
    <input type="button"  value="添加管理员"  onclick="javascript:location.href='<?php echo $url.'add';  ?>'"   />
    </div>
<form method="post">
<table>
    	<tr>
        	<th><input type="checkbox"  onclick="javascript:selectAll(this);" />ID</th>
            <th>管理员</th>
            <th>邮箱</th>
            <th>电话</th>
            <th>添加时间</th>
            <th>最近登陆</th>
            <th>上次IP</th>
            <th>是否可用</th>
            <th>是否在线</th>
            <th>操作</th>
        </tr>
        <? foreach($result as $res){ ?>
        <tr>
            <td><input type="checkbox" name="ids[]" class="ids" value="<?php echo $res['admin_id']; ?>" /><?= $res['admin_id']; ?></td>
            <td><?php echo $res['admin_name']; ?></td>
            <td><?php echo $res['admin_email']; ?></td>
            <td><?php echo $res['admin_phone']; ?></td>
            <td><?php echo date('Y-m-d',$res['add_time']); ?></td>
            <td><?php echo date('Y-m-d',$res['last_login']); ?></td>
            <td><?php echo $res['last_ip']; ?></td>
            <td><?php if($res['enable']) echo '<label style="color:green;">可用</label>';else echo '<label style="color:red;">不可用</label>'; ?></td>
            <td><?php if($res['is_online'])echo '<label style="color:green;">在线</label>';else echo '<label style="color:red;">离线</label>'; ?></td>
            <td><a href="<?php echo $url.'edit?id='.$res['admin_id'];  ?>">编辑</a>|<a href="<?php echo $url.'delete?id='.$res['admin_id'];  ?>">删除</td>
        </tr>
        <?php } ?>
        <tr align="left"><td colspan="7" align="left">&nbsp;&nbsp;<input type="submit" class="button" value="删除"></td></tr>
    </table>
    </form>
    </div>
</body>
</html>